#include "Condition.h"

Condition::Condition(void)
{
    pthread_cond_init(&m_cond, NULL);
}

Condition::~Condition(void)
{
    pthread_cond_destroy(&m_cond);
}

int Condition::Wait(Mutex* pMutex)
{
    return pthread_cond_wait(&m_cond, &(pMutex->m_mutex));
}

int Condition::TimedWait(Mutex* pMutex, const struct timespec* abstime)
{
    return pthread_cond_timedwait(&m_cond, &(pMutex->m_mutex), abstime);
}

int Condition::Signal()
{
    return pthread_cond_signal(&m_cond);
}

int Condition::Broadcast()
{
    return pthread_cond_broadcast(&m_cond);
}


